package neptune.web.client.view.components.dialogs;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class ConsoleSSHDialog extends DialogBox implements ClickListener
{
	
	public ConsoleSSHDialog(String ipServer, String porta)
	{
		super(false, false);
		setText(" SSH console ");
		
		VerticalPanel vPanel = new VerticalPanel();
		//vPanel.setHeight("480px");
		//vPanel.setWidth("640px");
		Button buttonClose = new Button("Close");
		buttonClose.setTitle("Close the SSH console!");
		buttonClose.addClickListener(this);
		buttonClose.setStylePrimaryName("HelpDialog-closeButton");
		buttonClose.setWidth("100%");
		buttonClose.setHeight("20px");
		vPanel.add(buttonClose);
		vPanel.setCellWidth(buttonClose, "100%");
		
        HTML htmlApplet = new HTML();
		/*
		String html="<html><body>" +
			"<h2>Put here some information about console SSH</h2>"+
			"<APPLET CODE='com.mindbright.application.MindTerm.class' ARCHIVE='http://localhost:8080/emuPlugin/mindterm.jar' WIDTH=0 HEIGHT=0>"+
			"<PARAM NAME='cabinets' VALUE='mindterm.cab'>"+
			"<PARAM NAME='sepframe' value='true'>"+
			"<PARAM NAME='debug' value='true'>"+
			"<PARAM NAME='server' value='"+ipServer+"'>"+
			"</APPLET></body></html>";
			*/
        /*
        String html="<html><body>" +
        	"<applet width='640' height='480' archive='SSHTermApplet-signed.jar,SSHTermApplet-jdkbug-workaround-signed.jar,SSHTermApplet-jdk1.3.1-dependencies-signed.jar'"+
        	"code='com.sshtools.sshterm.SshTermApplet'"+
        	"codebase='.' style='border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1'>"+
        	"<param name='sshapps.connection.host' value='"+ipServer+"'>"+
        	"<param name='sshapps.connection.port' value='"+porta+"'>"+
        	"<param name='sshapps.connection.userName' value='root'>"+
        	"<param name='sshapps.connection.connectImmediately' value='true'>"+
        	"<param name='sshapps.connection.authenticationMethod' value='password'>"+
        	"</applet></body></html>";
        	*/
        String html="<html><body>" +
        "<applet code='com.jcraft.jcterm.JCTermApplet.class'"+
            "archive='jcterm-0.0.10.jar,jsch-0.1.38.jar,compression.jar,jzlib-1.0.9.jar,3des.jar,blowfish.jar'"+
            "width='700' height='600'>"+
    	"</applet></body></html>";
		htmlApplet.setHTML(html);
		vPanel.add(htmlApplet);
		//Window.open("http://www.google.com/", "_blank","status=0,toolbar=0,menubar=0,location=0,resizable=0");
		setWidget(vPanel);
		setStylePrimaryName("HelpDialog");
	}

	public void onClick(Widget sender) 
	{
		this.hide();
	}

}
